package com.consumer.user.controller;

import com.common.consumer.controller.AbstractConsumerGenericController;
import com.common.consumer.service.ConsumerGenericService;
import com.consumer.user.service.ConsumerUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 类描述：用户的消费者controller
 *
 * @author linzf
 */
@RestController
@RequestMapping("/user")
public class ConsumerUserController extends AbstractConsumerGenericController {

    @Autowired
    private ConsumerUserService consumerUserService;

    @Override
    protected ConsumerGenericService getService() {
        return this.consumerUserService;
    }


    /**
     * 功能描述：保存数据
     * @param entity
     * @return
     */
    @Override
    public Map<String, Object> save(@RequestBody Map<String, Object> entity) {
        return consumerUserService.saveUser(entity);
    }

    /**
     * 功能描述：获取用户数据
     * @param entity
     * @return
     */
    @Override
    public Map<String, Object> get(@RequestBody Map<String, Object> entity) {
        return consumerUserService.getUser(entity);
    }

    /**
     * 功能描述：更新用户数据
     * @param entity
     * @return
     */
    @Override
    public Map<String, Object> update(@RequestBody Map<String, Object> entity) {
        return consumerUserService.updateUser(entity);
    }
}
